package com.yeyks.common.em;

/**
 * @author fuchangshuai
 * @date 2019/06/17 09:52
 * "{10000:6,20000:4,30000:2}"
 */
public enum BagGiftAmountEnum {

    ONE(10000, 6),
    TWO(20000, 1),
    THREE(30000, 1),
    FIVE(5000, 6);

    int value;
    int desc;

    BagGiftAmountEnum(int value, int desc) {
        this.value = value;
        this.desc = desc;
    }

    public Integer value() {
        return this.value;
    }

    public int desc() {
        return this.desc;
    }

    public static int getDesc(int value) {
        BagGiftAmountEnum[] bagGiftAmountEnums = values();
        for (BagGiftAmountEnum bagGiftAmountEnum : bagGiftAmountEnums) {
            if (bagGiftAmountEnum.value() == value) {
                return bagGiftAmountEnum.desc();
            }
        }
        return 0;
    }

    public static int getValue(int desc) {
        BagGiftAmountEnum[] bagGiftAmountEnums = values();
        for (BagGiftAmountEnum bagGiftAmountEnum : bagGiftAmountEnums) {
            if (bagGiftAmountEnum.desc() == desc) {
                return bagGiftAmountEnum.value();
            }
        }
        return 0;
    }
}
